import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Layout from '@/views/main/index.vue'

const routes:Array<RouteRecordRaw> = [
    {
        path: '/login',
        name: 'Login',
        component: ()=> import('@/components/Login.vue'),
        meta: { hidden: true }
    },
    {
        path: '/',
        name: '_home',
        component: Layout,
        redirect: '/home',
        meta: { title: '系统首页', icon: 'icon-shouye' },
        children: [
            {
                path: 'home',
                name: 'home',
                component: () => import('@/views/home/Home.vue'),
                meta: {
                    title: '系统首页'
                }
            }
        ]
    },
    {
        path: '/other',
        name: 'other',
        component: Layout,
        redirect: '/other/user',
        meta: {
            title: '其他设置',
            icon: 'icon-qita'
        },
        children: [
            {
                path: 'user',
                name: 'user',
                component: () => import('@/views/other/User.vue'),
                meta: { title: '用户管理' }
            },
            {
                path: 'role',
                name: 'role',
                component: () => import('@/views/role/Role.vue'),
                meta: {
                    title: '角色管理'
                }
            }
        ]
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router
